import Vue from "vue";

Vue.filter("bindStatus", (value) => {
	var status = ''
	if (value == '') {
		status = '-'
	} else {
		switch (Number(value)) {
			case 0:
				status = "已解绑"
				break;
			case 1:
				status = "已绑定"
				break;
			case 3:
				status = "已激活"
				break;
			default:
				break;
		}
	}

	return status
});
Vue.filter("payType", value => {
	var status = ''
	switch (value) {

		case 1:
			status = 'POS消费'
			break;
		case 2:
			status = '支付宝'
			break;
		case 3:
			status = '微信'
			break;
		case 4:
			status = '快捷'
			break;
		case 5:
			status = '银联二维码'
			break;
		case 6:
			status = '微信商家扫码'
			break;
		case 7:
			status = '支付宝商家扫码'
			break;
		default:
			break;
	}
	return status
});

/**
 * @title 支付方式
 * @param {number} totalType  交易类型
 * @return {String} status 
 * */
Vue.filter("totalType", (value) => {
	var status = ''
	switch (value) {
		case 1:
			status = "POS贷记卡"
			break;
		case 2:
			status = "POS借记卡"
			break;
		case 3:
			status = "云闪付"
			break;
		case 4:
			status = "扫码"
			break;
		case 5:
			status = "VIP贷记卡"
			break;
		case 6:
			status = "VIP借记卡"
			break;
		case 7:
			status = "快捷"
			break;
		case 8:
			status = "服务费"
			break;
		case 9:
			status = "通讯费"
			break;
		case 10:
			status = "汇收银扫码"
			break;
		case 11:
			status = "聚收银扫码"
			break;
		case 12:
			status = "一码聚扫码"
			break;
		default:
			status = ''
			break;
	}
	return status
});

Vue.filter("operateType", (value) => {
	var status = ''
	switch (value) {
		case 0:
			status = "分配"
			break;
		case 1:
			status = "划拨"
			break;
		case 2:
			status = "回拨"
			break;
		case 3:
			status = "绑定"
			break;
		case 4:
			status = "解绑"
			break;
		case 5:
			status = "回收"
			break;
		case 6:
			status = "删除"
			break;
		default:
			status = ''
			break;
	}
	return status
});



Vue.filter("operateStatus", (value) => {
	var status = ''
	switch (value) {
		case 0:
			status = "待确定"
			break;
		case 1:
			status = "通过"
			break;
		case 2:
			status = "拒绝"
			break;
		default:
			status = ''
			break;
	}
	return status
});


//邮费方式过滤器
Vue.filter("payWay", value => {
	var status = ''
	switch (value) {

		case '1':
			status = '到付'
			break;
		case '2':
			status = '积分支付 12.00积分'
			break;
		case '3':
			status = '支付宝支付邮费'
			break;
		case '4':
			status = '包邮'
			break;
		case '5':
			status = '自提'
			break;
		default:
			break;
	}
	return status
});
/*交易状态过滤器*/
Vue.filter("transStatus", value => {
	var status = ''
	switch (value) {

		case 1:
			status = '成功'
			break;
		case 2:
			status = '失败'
			break;
		case 3:
			status = '初始化'
			break;
		default:
			break;
	}
	return status
});
Vue.filter("tranType", (value) => {
	var status = ''
	if (value == '') {
		status = '-'
	} else {
		switch (Number(value)) {
			case 1:
				status = "普通刷卡"
				break;
			case 2:
				status = "云闪付"
				break;
			case 3:
				status = "扫码"
				break;
			default:
				break;
		}
	}

	return status
});

Vue.filter("condType", value => {
	var status = ''
	value = Number(value)
	switch (value) {
		case -2:
			status = '无达标考核'
			break;
		case -1:
			status = '未达标'
			break;
		case 0:
			status = '待达标'
			break;
		case 1:
			status = '已达标'
			break;
		default:
			if (value > 1) {
				status = '达标' + value
			}
			break;
	}
	return status
});




/**
 * 订单详情支付类型
 * */
Vue.filter("orderPayType", value => {
	var status = ''
	value = Number(value)
	switch (value) {

		case 1:
			status = '微信'
			break;
		case 2:
			status = '支付宝'
			break;
		case 3:
			status = '积分'
			break;
		case 4:
			status = '货款'
			break;
		case 0:
			status = '免费申领'
			break;
		default:
			break;
	}
	return status
});
/**
 * 信息筛选
 * */
Vue.filter("infoType", value => {
	if (value) {
		var status = ''
		console.log('tui', status)
		if (value == "推手货款账户提现") {
			status = "货款账户提现"
		} else if (value == "月激活底薪补助") {
			status = "月度津贴"
		} else {
			status = value
			status = value.replace(/推手/, "推客")
		}

		return status
	}
});

Vue.filter("phoneDesensitization", mobile => {
	return mobile?.substring(0, 3) +
		" **** " +
		mobile?.substring(
			mobile.length - 4,
			mobile.length
		)
})

Vue.filter("tuomin", value => {
	if (value && value.length > 1) {
		let startStr = ""
		for (let i = 0; i < value.length - 1; i++) {
			startStr += '*'
		}
		return value.substring(
			0,
			1
		) + startStr



	} else {
		return value
	}
})

Vue.filter("tuomin1", value => {
	if (value.length > 2) {
		return value.substring(0, 1) +
			"*" +
			value.substring(
				value.length - 1,
				value.length
			)
	} else if (value.length == 2) {
		return value.substring(0, 1) +
			"*"
	} else {
		return value
	}

})

Vue.filter("exeStatus", value => {
	var status = ''
	value = Number(value)
	switch (value) {
		case -1:
			status = '考核失败'
			break;
		case 0:
			status = '待考核'
			break;
		case 1:
			status = '考核中'
			break;
		case 2:
			status = '考核成功'
			break;
		default:
			break;
	}
	return status
});


Vue.filter("cardType", value => {
	var status = ''
	value = Number(value)
	switch (value) {
		case 0:
			status = '扫码'
			break;
		case 1:
			status = '贷记卡'
			break;
		case 2:
			status = '借记卡'
			break;
		default:
			break;
	}
	return status
});

Vue.filter("changeServiceType", value => {
	var status = ''
	value = Number(value)
	switch (value) {

		case 0:
			status = '申请中'
			break;
		case 1:
			status = '处理中'
			break;
		case 2:
			status = '修改完成'
			break;
		case 3:
			status = '修改失败'
			break;
		default:

			break;
	}
	return status
});
Vue.filter("rateType", value => {
	var status = ''
	value = Number(value)
	switch (value) {
		case 1:
			status = 'POS刷卡费率'
			break;
		case 2:
			status = '云闪付费率'
			break;
		case 3:
			status = '扫码费率'
			break;
		case 4:
			status = 'VIP刷卡费率'
			break;
		case 5:
			status = '快捷费率'
			break;
		case 6:
			status = '借记卡封顶'
			break;
		default:
			break;
	}
	return status
});